package com.edu.service.impl;/**
 * @Author:hcb
 * @Date:2025/9/19-09-19-12:26
 */

import com.edu.bean.Goods;
import com.edu.bean.Page;
import com.edu.dao.GoodsDao;
import com.edu.dao.impl.GoodsDaoImpl;
import com.edu.service.GoodsService;

import java.util.List;

/**
 *@Author:hcb
 *@Date:2025/9/19-09-19-12:26
 */
public class GoodsServiceImpl implements GoodsService {
    private GoodsDao goodsDao = new GoodsDaoImpl();

    @Override
    public Page<Goods> getAllGoods(int pageNum, int pageSize) {
        List<Goods> goodsList = goodsDao.selectAllGoods(pageNum, pageSize);
        int rows = goodsDao.selectAllGoodsNum();
        Page<Goods> page = new Page(goodsList,pageNum,pageSize,rows);
        return page;
    }

    @Override
    public int deleteGoodsById(int goodsId) {
        return goodsDao.deleteGoodsById(goodsId);

    }
}
